package com.dai.train.common.util;

import cn.hutool.core.util.IdUtil;

/**
 * 封装雪花算法
 */
public class SnowUtil {

    // 数据中心
    private static long dataCenterId = 1;

    // 机器标识
    private static long workId = 1;

    public static long getSnowflakeNextId(){
        return IdUtil.getSnowflake(workId,dataCenterId).nextId();
    }
    public static String getSnowflakeNextIdStr(){
        return IdUtil.getSnowflake(workId,dataCenterId).nextIdStr();
    }
}
